package org.warclub.chatclient;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.JButton;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JPasswordField;

public class LoginClient {

	private JFrame frame;
	private JTextField txtFldUserName;
	private JPasswordField pwdFldPassword;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					LoginClient window = new LoginClient();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public LoginClient() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 490, 188);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JLabel lblUserName = new JLabel("User :");
		lblUserName.setHorizontalAlignment(SwingConstants.RIGHT);
		lblUserName.setBounds(10, 11, 97, 14);
		frame.getContentPane().add(lblUserName);
		
		JLabel lblPassword = new JLabel("Password :");
		lblPassword.setHorizontalAlignment(SwingConstants.RIGHT);
		lblPassword.setBounds(10, 36, 97, 14);
		frame.getContentPane().add(lblPassword);
		
		txtFldUserName = new JTextField();
		txtFldUserName.setBounds(117, 8, 142, 20);
		frame.getContentPane().add(txtFldUserName);
		txtFldUserName.setColumns(10);
		
		JButton btnSignIn = new JButton("Sign in");
		btnSignIn.setBounds(10, 65, 249, 33);
		frame.getContentPane().add(btnSignIn);
		
		JButton btnForgotPassword = new JButton("Forget password ? Click here ...");
		btnForgotPassword.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JOptionPane.showMessageDialog(null, "Kệ mày :))", "Forgot password", JOptionPane.INFORMATION_MESSAGE);
			}
		});
		btnForgotPassword.setBounds(10, 103, 249, 33);
		frame.getContentPane().add(btnForgotPassword);
		
		JPanel panel = new JPanel();
		panel.setBackground(new Color(30, 144, 255));
		panel.setForeground(new Color(30, 144, 255));
		panel.setBounds(297, 9, 167, 127);
		frame.getContentPane().add(panel);
		
		pwdFldPassword = new JPasswordField();
		pwdFldPassword.setBounds(117, 33, 142, 20);
		frame.getContentPane().add(pwdFldPassword);
	}
}
